home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1113 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.3 KB  |  60 lines

  1. Newsgroups: comp.lang.c
  2. Path: uu4news.netcom.com!friend!news
  3. From: rich@kastle.com (Richard Krehbiel)
  4. Subject: Pondering cpp... (was: Override a cpp macro?)
  5. Message-ID: <1996Jan11.134602.1234@friend.kastle.com>
  6. Sender: news@friend.kastle.com (News)
  7. Reply-To: rich@kastle.com
  8. Organization: Kastle Development Associates
  9. X-Newsreader: Forte Free Agent 1.0.82
  10. References: <4d0v5r$6fs@oak78.doc.ic.ac.uk> <TANMOY.96Jan10131159@qcd.lanl.gov>
  11. Date: Thu, 11 Jan 1996 13:48:56 GMT
  12.  
  13. tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) wrote:
  14.  
  15. >--text follows this line--
  16. >In article <4d0v5r$6fs@oak78.doc.ic.ac.uk> rwmj@doc.ic.ac.uk (Richard
  17. >Jones) writes: 
  18.  
  19. >   I'm trying to redefine a cpp macro, but using the old definition. I've got
  20. >   a macro defined:
  21. >
  22. >   [...]
  23. >
  24. >Unfortunately, the C preprocessor has very limited capabilities. No,
  25. >it is not an obvious thing to want to do in a C preprocessor.
  26.  
  27. You know, I've quite often wished for a more powerful macro processor.
  28. Some Unix versions of cc have a option to pass the C source through
  29. the m4 macro processor instead of cpp, and while m4 is a far more
  30. powerful macro language, it's also very difficult to use and not at
  31. all compatible; cpp macros aren't m4 macros.
  32.  
  33. (BTW not that this helps, but m4 can do what the original poster was
  34. asking.)
  35.  
  36. Perhaps I could write a cpp-to-m4 translator.  Then I'd pass my
  37. source, including anyone's headers, through the translator first, then
  38. through m4, then into the compiler.  Then I can use a of mix cpp and
  39. m4 macros.  Easier would be simply passing the source through cpp
  40. first, then m4, but then I wouldn't be able to use cpp #defines in m4
  41. macros or vice versa.
  42.  
  43. I've pondered writing an enhanced cpp (probably by extending GNU cpp)
  44. that has multiple-line macros that may contain pp commands, iteration,
  45. arithmetic, powerful string expressions, etc.
  46.  
  47. But then, I'd have a new language that no one else uses, and likely no
  48. one else would want to.  Nobody likes new translation steps.  And
  49. integrated Windows development environments are typically unable to
  50. support unusual source file types (first hand experience here; I have
  51. a Windows project with a YACC component that I always have to process
  52. by hand).
  53.  
  54. Sigh.
  55.  
  56. --
  57. Richard Krehbiel, Kastle Systems, Arlington VA USA
  58. rich@kastle.com (work) or richk@cais.com (personal)
  59.  
  60.